/**   
* @Title: ReturnMsg.java 
* @Package: com.ifuntimes.http
* @Description: TODO
* @author:YuHai
* @Email: it@ifuntimes.com  
* @date 2017年09月05日 上午9:56:53 
* @version V1.0   
*/
package com.ifuntimes.http;

import com.alibaba.fastjson.JSONObject;

/**
 * @ClassName: ReturnMsg
 * @Description: TODO
 * @author YuHai it@ifuntimes.com  
 * @date 2017年09月05日 上午9:56:53 
 * 
 */
public class ReturnMsg {

	private int errcode;

	private String errmsg;

	private Object data;

	public ReturnMsg(int errcode, String errmsg) {
		this.errcode = errcode;
		this.errmsg = errmsg;
	}

	public ReturnMsg(int errcode, String errmsg, Object data) {
		this.errcode = errcode;
		this.errmsg = errmsg;
		this.data = data;
	}

	public int getErrcode() {
		return errcode;
	}

	public String getErrmsg() {
		return errmsg;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	/*
	 * (非 Javadoc) <p>Title: toString</p> <p>Description: </p>
	 * 
	 * @return
	 * 
	 * @see java.lang.Object#toString()
	 */

	@Override
	public String toString() {
		ReturnMsg msg = new ReturnMsg(this.getErrcode(), this.getErrmsg());
		if (this.data != null)
			msg.setData(this.data);
		return JSONObject.toJSONString(msg);

	}

}
